package com.heima.user.controller;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.heima.common.dto.ResponseResult;
import com.heima.user.dto.AuthDto;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.heima.user.service.IApUserRealnameService;
import java.util.List;
import java.util.Map;

import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * APP实名认证信息表 前端控制器
 * </p>
 *
 * @author gyq
 * @since 2022-06-26
 */
@RestController
@RequestMapping("/api/v1/user_realname")
@Api(tags = "APP实名认证信息表接口")
@CrossOrigin
public class ApUserRealnameController{

    @Autowired
    private IApUserRealnameService apUserRealnameService;

    /**
     * 按照状态查询用户认证列表
     * @param dto
     * @return
     */
    @PostMapping("/list")
    @ApiOperation(value = "listByStatus", notes = "根据状态查询实名认证列表数据")  // value指名称  notes 备注
    @ApiModelProperty(name = "dto", dataType = "AuthDto",required = true)
    public ResponseResult listByStatus(@RequestBody AuthDto dto){
        return apUserRealnameService.listByStatus(dto);
    }

    /**
     * 审核失败
     * @param dto
     * @return
     */
    @PostMapping("/authFail")
    @ApiOperation(value = "authFail", notes = "实名认证驳回")  // value指名称  notes 备注
    @ApiModelProperty(name = "dto", dataType = "AuthDto",required = true)
    public ResponseResult authFail(@RequestBody AuthDto dto){
        return apUserRealnameService.auth(dto,0);  //实名认证驳回
    }

    /**
     * 审核通过
     * @param dto
     * @return
     */
    @PostMapping("/authPass")
    @ApiOperation(value = "authPass", notes = "实名认证通过")  // value指名称  notes 备注
    @ApiModelProperty(name = "dto", dataType = "AuthDto",required = true)
    public ResponseResult authPass(@RequestBody AuthDto dto){
        return apUserRealnameService.auth(dto,1); //实名认证通过
    }

}
